import './style/header.less'
import React, { useState } from "react"
import {Link} from 'react-router-dom'
import { Row, Col, Input, Button } from "antd"
import { baseUrl, register, } from '../config/urls'
const { Search } = Input

export default function () {
    const [kw, setKw] = useState()
    const onSearch = () => {
        window.location.href = `http://www.iyigong.com/search.php?mod=forum&orderby=lastpost&ascdesc=desc&searchsubmit=yes&kw=${kw}`
    }

    return <div className='m-header'>
        <div className="container">
            <Row justify='space-between'>
                <Col span='4' className='l'>
                    <Link to='/'><div className='logo' /></Link>
                </Col>
                <Col span='20' offset='0' className='r'>
                    <Search placeholder="请输入关键字" onSearch={onSearch} enterButton value={kw} onChange={e => setKw(e.target.value)} />
                    <Button type="primary"><a href={baseUrl + register} target='_blank'>登陆</a></Button>
                    <Button ><a href={baseUrl + register} target='_blank'>注册</a></Button>
                    <a href={baseUrl} className='toForum' target='_blank' ><i className='iconfont i-forum' /></a>
                </Col>
            </Row>
        </div>

    </div>
}